package com.liddhome.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.liddhome.entity.Adpic;
import com.liddhome.service.AdpicService;
import com.liddhome.util.ResponseUtil;

import net.sf.json.JSONObject;

/**
 * 广告图片Controller层
 * @author lidd
 *
 */
@Controller
@RequestMapping("/adpic")
public class AdpicController {

	@Resource
	private AdpicService adpicService;
	
	/**
	 * 请求主页
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/list")
	public String list(HttpServletRequest request,HttpServletResponse response)throws Exception{
		JSONObject result=new JSONObject();
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("state", 1);
		List<Adpic> adpicList=adpicService.list(map);
		result.put("adpicList", adpicList);
		ResponseUtil.write(response, result);
		return "foreground/ad/carousel";
	}
}
